package com.diandi.messages.utils.http;

import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 *  封装业务报文信息
 * @author mwz
 * @create 2017-08-23 13:11
 * @version V1.0.0

 */
public class PackageParams {

    /**
     * 封装过程信息表
     * @param params
     * @return
     */
    /*public static SignatureProcessLog getInitSignatureProcessLogtPkgMsg(Map<String, String> params) {
        SignatureProcessLog signatureProcessLog  = new SignatureProcessLog();
        signatureProcessLog.setSignatureCode( params.get("signatureCode") );
        signatureProcessLog.setContractBatchCode( params.get("contractCode") );
        signatureProcessLog.setContractCode( params.get("contractCode") );
        signatureProcessLog.setInterfaceType( Integer.parseInt( params.get("InterfaceType") ) );
        signatureProcessLog.setContractTemplateCode( params.get("contractType") );
        if (params.containsKey("borrowId") && StringUtils.isNotBlank(params.get("borrowId"))){
            signatureProcessLog.setBorrowId( Long.parseLong( params.get("borrowId") ) );
        }
        if (params.containsKey("userId") && StringUtils.isNotBlank(params.get("userId"))){
            signatureProcessLog.setUserId(  Long.parseLong(params.get("userId") ) );
        }
        signatureProcessLog.setContractTitle( params.get("contractTitle") );
        signatureProcessLog.setBusinessStatus( BusinessStatus.接收成功.getStatus() );
        signatureProcessLog.setPlatformStatus(PlatFormStatus.数据保存完成.getStatus() );
        signatureProcessLog.setPassStatus( PassStatus.初始状态.getStatus() );
        signatureProcessLog.setProcessFlag(ProcessFlag.初始.getType() );
        return signatureProcessLog;
    }*/

    /**
     * 封装过程明细信息表
     * @param params
     * @return
     */
    /*public static SignatureProcessDetail getSignatureProcessDetailPkgMsg(Map<String, String> params) {

        SignatureProcessDetail signatureProcessDetail = new SignatureProcessDetail();

        signatureProcessDetail.setSignatureCode( params.get("signatureCode") );
        signatureProcessDetail.setContractBatchCode( params.get("contractCode") );
        signatureProcessDetail.setContractCode( params.get("contractCode") );
        signatureProcessDetail.setContractTemplateCode( params.get("contractType") );
        signatureProcessDetail.setInterfaceType( Integer.parseInt( params.get("InterfaceType") ) );
        if (params.containsKey("borrowId") && StringUtils.isNotBlank(params.get("borrowId"))){
            signatureProcessDetail.setBorrowId( Long.parseLong( params.get("borrowId") ) );
        }

        if (params.containsKey("userId") && StringUtils.isNotBlank(params.get("userId"))){
            signatureProcessDetail.setUserId(  Long.parseLong(params.get("userId") ) );
        }
        signatureProcessDetail.setContractTitle( params.get("contractTitle") );
        signatureProcessDetail.setBusinessStatus( BusinessStatus.接收成功.getStatus() );
        signatureProcessDetail.setPlatformStatus(PlatFormStatus.数据保存完成.getStatus() );
        signatureProcessDetail.setProcessFlag( ProcessFlag.初始.getType() );
        return signatureProcessDetail;
    }*/

    /*public static SignatureProcessDetail getUpdateProcessDetailPkgMsg(Map<String, String> params) {

        SignatureProcessDetail signatureProcessDetail = new SignatureProcessDetail();

        signatureProcessDetail.setSignatureCode( params.get("signatureCode") );
        signatureProcessDetail.setContractBatchCode( params.get("contractCode") );
        signatureProcessDetail.setContractCode( params.get("contractCode") );
        signatureProcessDetail.setContractTemplateCode( params.get("contractType") );

        if (params.containsKey("InterfaceType") && StringUtils.isNotBlank(params.get("InterfaceType"))){
            signatureProcessDetail.setInterfaceType(  Integer.parseInt(params.get("InterfaceType") ) );
        }

        if (params.containsKey("borrowId") && StringUtils.isNotBlank(params.get("borrowId"))){
            signatureProcessDetail.setBorrowId( Long.parseLong( params.get("borrowId") ) );
        }

        if (params.containsKey("userId") && StringUtils.isNotBlank(params.get("userId"))){
            signatureProcessDetail.setUserId(  Long.parseLong(params.get("userId") ) );
        }
        signatureProcessDetail.setContractTitle( params.get("contractTitle") );
        signatureProcessDetail.setBusinessStatus( BusinessStatus.接收成功.getStatus() );
        signatureProcessDetail.setPlatformStatus(PlatFormStatus.数据保存完成.getStatus() );
        signatureProcessDetail.setPassStatus(PassStatus.同步处理成功.getStatus() );
        signatureProcessDetail.setProcessFlag( ProcessFlag.处理完成.getType() );

        return signatureProcessDetail;
    }*/

    /**
     * 封装过程明细信息表
     * @param
     * @return
     */
    /*public static SignatureProcessDetail getSignatureProcessDetailPkgMsg(  SignatureProcessLog signatureProcessLog ) {

        SignatureProcessDetail signatureProcessDetail = new SignatureProcessDetail();
        signatureProcessDetail.setSignatureCode( signatureProcessLog.getSignatureCode() );
        signatureProcessDetail.setUserId(  signatureProcessLog.getUserId() );
        signatureProcessDetail.setContractBatchCode( signatureProcessLog.getContractBatchCode() );
        signatureProcessDetail.setContractCode( signatureProcessLog.getContractCode() );
        signatureProcessDetail.setContractTemplateCode( signatureProcessLog.getContractTemplateCode() );
        signatureProcessDetail.setBorrowId( signatureProcessLog.getBorrowId() );
        signatureProcessDetail.setInterfaceType(  signatureProcessLog.getInterfaceType() );
        signatureProcessDetail.setContractTitle( signatureProcessLog.getContractTitle() );
        signatureProcessDetail.setBusinessStatus(signatureProcessLog.getBusinessStatus() );
        signatureProcessDetail.setPlatformStatus( signatureProcessLog.getPlatformStatus() );
        signatureProcessDetail.setPassStatus ( signatureProcessLog.getPassStatus() );
        signatureProcessDetail.setProcessFlag( signatureProcessLog.getProcessFlag() );
        return signatureProcessDetail;
    }*/

    /**
     * 封装合同报文表
     * @param params
     * @return
     */
    /*public static SignatureContract getSignatureContractPkgmsg(Map<String, String> params) {

        SignatureContract signatureContract = new SignatureContract();
        signatureContract.setSignatureCode( params.get("signatureCode") );
        signatureContract.setContractBatchCode( params.get("contractCode") );
        signatureContract.setContractCode( params.get("contractCode") );
        if (params.containsKey("userId") && StringUtils.isNotBlank(params.get("userId"))){
            signatureContract.setUserId(  Long.parseLong(params.get("userId") ) );
        }
        signatureContract.setContractTemplateCode( params.get("contractType") );
        if (params.containsKey("borrowId") && StringUtils.isNotBlank(params.get("borrowId"))){
            signatureContract.setBorrowId( Long.parseLong( params.get("borrowId") ) );
        }
        signatureContract.setPassCode( params.get("passCode") );
        signatureContract.setMerchantNo( params.get("merchantNo"));
        signatureContract.setContractTitle( params.get("contractTitle") );
        signatureContract.setContractDownloadUrl(  params.get("contractDownloaUrl") );
        signatureContract.setContractViewUrl( params.get("contractViewUrl") );
        signatureContract.setStatus( Integer.parseInt( ContractStatus.合同信息落库.getType() ) );

        return signatureContract;
    }*/

    /*public static SignatureContractDetail getSignatureTM01PkgMsg(  Map<String,String> paramMap, Map<String, String> reqMap,Map<String, String> rtnMap,String status ) {

        SignatureContractDetail signatureContractDetail = new SignatureContractDetail();
        signatureContractDetail.setSignatureCode( paramMap.get("signatureCode") );
        signatureContractDetail.setSignatureTrade( reqMap.get("signatureTrade") );
        if (paramMap.containsKey("userId") && StringUtils.isNotBlank(paramMap.get("userId"))){
            signatureContractDetail.setUserId( Long.parseLong( paramMap.get("userId")) );
        }
        signatureContractDetail.setContractBatchCode( paramMap.get("contractCode") );
        signatureContractDetail.setContractCode( paramMap.get("contractCode") );
        signatureContractDetail.setContractTemplateCode( paramMap.get("contractType") );
        if (paramMap.containsKey("borrowId") && StringUtils.isNotBlank(reqMap.get("borrowId"))){
            signatureContractDetail.setBorrowId( Long.parseLong( reqMap.get("borrowId") ) );
        }
        signatureContractDetail.setMerchantNo( paramMap.get("merchantNo"));
        signatureContractDetail.setPassCode( paramMap.get("passCode") );
        if (paramMap.containsKey("investorId") && StringUtils.isNotBlank(paramMap.get("investorId"))){
            signatureContractDetail.setInvestorId( Long.parseLong( reqMap.get("investorId") ) );
        }

        signatureContractDetail.setContractTitle( paramMap.get("contractTitle") );
        signatureContractDetail.setStatus( Integer.parseInt( status ) );
        signatureContractDetail.setRequestMsg(  "" );
        signatureContractDetail.setReturnMsg( rtnMap.toString() );
        if (paramMap.containsKey("unnofifyMsg") && StringUtils.isNotBlank(paramMap.get("unnofifyMsg"))){
            signatureContractDetail.setUnnofifyMsg(  paramMap.get("unnofifyMsg")   );
        }

        signatureContractDetail.setSignatureKeyword( reqMap.get("signatureKeyword")  );
        signatureContractDetail.setContractViewUrl( rtnMap.get("viewpdf_url") );
        signatureContractDetail.setContractDownloadUrl(  rtnMap.get("download_url") );

        return signatureContractDetail;
    }*/
    /**
     * 封装合同明细报文表
     * @param params
     * @return
     */
    /*public static SignatureContractDetail getSignatureContractDetailPkgMsg(Map<String, String> params) {

        SignatureContractDetail signatureContractDetail = new SignatureContractDetail();

        signatureContractDetail.setSignatureCode( params.get("signatureCode") );
        if (params.containsKey("userId") && StringUtils.isNotBlank(params.get("userId"))){
            signatureContractDetail.setUserId( Long.parseLong( params.get("userId")) );
        }
        signatureContractDetail.setContractBatchCode( params.get("contractCode") );
        signatureContractDetail.setContractCode( params.get("contractCode") );
        signatureContractDetail.setContractTemplateCode( params.get("contractType") );
        if (params.containsKey("borrowId") && StringUtils.isNotBlank(params.get("borrowId"))){
            signatureContractDetail.setBorrowId( Long.parseLong( params.get("borrowId") ) );
        }
        signatureContractDetail.setMerchantNo( params.get("merchantNo"));
        signatureContractDetail.setPassCode( params.get("passCode") );
        if (params.containsKey("investorId") && StringUtils.isNotBlank(params.get("investorId"))){
            signatureContractDetail.setInvestorId( Long.parseLong( params.get("investorId") ) );
        }

        signatureContractDetail.setContractTitle( params.get("contractTitle") );
        signatureContractDetail.setStatus( Integer.parseInt( ContractStatus.合同签章完成.getType() ) );
        signatureContractDetail.setRequestMsg(  "" );
        //signatureContractDetail.setUnnofifyMsg( params.get("unnofifyMsg")  );
        signatureContractDetail.setSignatureKeyword( params.get("signatureKeyword")  );
//        signatureContractDetail.setContractDownloadUrl(  params.get("contractDownloaUrl") );
        signatureContractDetail.setContractViewUrl( params.get("contractViewUrl") );
        signatureContractDetail.setContractDownloadUrl(  params.get("contractDownloadUrl") );
        signatureContractDetail.setContractViewUrl( params.get("contractViewUrl") );


//        signatureContractDetail.setMerchantNo("merchantNo");
        return signatureContractDetail;
    }*/


    /**
     * 封装业务报文
     *
     * @param params
     * @return
     */
    /*public static SignatureBusinessPkgmsg getBusinessPkgmsg(Map<String, String> params) {
        SignatureBusinessPkgmsg businessPkgmsg = new SignatureBusinessPkgmsg();
        businessPkgmsg.setUserId( Long.parseLong( params.get("userId") ));
        businessPkgmsg.setTradeNo(params.get("contractCode"));
        businessPkgmsg.setPassCode(params.get("passCode"));
        businessPkgmsg.setMerchantNo(params.get("merchantNo"));
        businessPkgmsg.setInterfaceType( Integer.parseInt( params.get("InterfaceType") ) );
        businessPkgmsg.setRequestMsg(params.get("requestMsg"));
        businessPkgmsg.setReturnMsg(params.get("returnMsg"));
        businessPkgmsg.setUnnotifyMsg( params.get("unnotifyMsg"));
        businessPkgmsg.setStatus( PkgMsgStatus.正在处理中.getStatus() );
        return businessPkgmsg;
    }*/


    /*public static SignatureBusinessPkgmsg getInsertRvcPkgMsgInfo(Map<String, String> params) {
        SignatureBusinessPkgmsg businessPkgmsg = new SignatureBusinessPkgmsg();
        businessPkgmsg.setUserId( Long.parseLong( params.get("userId") ));
        businessPkgmsg.setTradeNo(params.get("contractCode"));
        businessPkgmsg.setPassCode(params.get("passCode"));
        businessPkgmsg.setMerchantNo(params.get("merchantNo"));
        businessPkgmsg.setInterfaceType( Integer.parseInt( params.get("InterfaceType") ) );
        businessPkgmsg.setRequestMsg(params.get("requestMsg"));
        businessPkgmsg.setReturnMsg(params.get("returnMsg"));
        businessPkgmsg.setUnnotifyMsg( params.get("unnotifyMsg"));
        businessPkgmsg.setUnnotifyUrl( params.get("notifyUrl"));
        businessPkgmsg.setStatus( PkgMsgStatus.正在处理中.getStatus() );
        return businessPkgmsg;
    }*/




    /*public static SignatureBusinessPkgmsg getUpdateRvcPkgMsgInfo(Map<String, String> params) {
        SignatureBusinessPkgmsg businessPkgmsg = new SignatureBusinessPkgmsg();
        businessPkgmsg.setUserId( Long.parseLong( params.get("userId") ));
        businessPkgmsg.setTradeNo(params.get("tradeNo"));
        businessPkgmsg.setPassCode(params.get("passCode"));
        businessPkgmsg.setReturnMsg(params.get("returnMsg"));
        businessPkgmsg.setUnnotifyMsg( params.get("unnotifyMsg"));
        businessPkgmsg.setStatus( PkgMsgStatus.成功.getStatus() );
        return businessPkgmsg;
    }*/

    /*public static SignaturePlatformPkgMsg getInsertSendPkgMsgInfo(Map<String, String> params) {
        SignaturePlatformPkgMsg businessPkgmsg = new SignaturePlatformPkgMsg();
        businessPkgmsg.setUserId( Long.parseLong( params.get("userId") ));
        businessPkgmsg.setTradeNo(params.get("contractCode"));
        businessPkgmsg.setPassCode(params.get("passCode"));
        businessPkgmsg.setMerchantNo(params.get("merchantNo"));
        businessPkgmsg.setInterfaceType( Integer.parseInt( params.get("InterfaceType") ) );
        businessPkgmsg.setRequestMsg(params.get("requestMsg"));
        businessPkgmsg.setReturnMsg(params.get("returnMsg"));
        businessPkgmsg.setUnnotifyMsg( params.get("unnotifyMsg"));
        businessPkgmsg.setStatus( PkgMsgStatus.正在处理中.getStatus() );
        return businessPkgmsg;
    }*/

    /*public static SignaturePlatformPkgMsg getCompleteSendPkgMsgInfo(Map<String, String> params) {
        SignaturePlatformPkgMsg businessPkgmsg = new SignaturePlatformPkgMsg();
        businessPkgmsg.setUserId( Long.parseLong( params.get("userId") ));
        businessPkgmsg.setTradeNo(params.get("contractCode"));
        businessPkgmsg.setPassCode(params.get("passCode"));
        businessPkgmsg.setMerchantNo(params.get("merchantNo"));
        businessPkgmsg.setInterfaceType( Integer.parseInt( params.get("InterfaceType") ) );
        businessPkgmsg.setRequestMsg(params.get("requestMsg"));
        businessPkgmsg.setReturnMsg(params.get("returnMsg"));
        businessPkgmsg.setUnnotifyMsg( params.get("unnotifyMsg"));
        businessPkgmsg.setStatus( PkgMsgStatus.成功.getStatus() );
        return businessPkgmsg;
    }*/

    /*public static SignaturePlatformPkgMsg getUpdateSendPkgMsgInfo(Map<String, String> params) {
        SignaturePlatformPkgMsg businessPkgmsg = new SignaturePlatformPkgMsg();

        businessPkgmsg.setTradeNo( params.get("transaction_id") );
        businessPkgmsg.setReturnMsg(params.get("returnMsg"));
        businessPkgmsg.setUnnotifyMsg( params.get("unnotifyMsg"));
        businessPkgmsg.setStatus( PkgMsgStatus.成功.getStatus() );
        return businessPkgmsg;
    }*/


    /**
     * 封装平台报文
     * @param params
     * @return
     */
    /*public static SignaturePlatformPkgMsg getPlatFormPkgmsg(Map<String, String> params) {
        SignaturePlatformPkgMsg businessPkgmsg = new SignaturePlatformPkgMsg();
        businessPkgmsg.setUserId( Long.parseLong( params.get("userId") ) );
        businessPkgmsg.setTradeNo(params.get("tradeNo"));
        businessPkgmsg.setPassCode(params.get("passCode"));
        businessPkgmsg.setMerchantNo(params.get("merchantNo"));

        businessPkgmsg.setInterfaceType( Integer.parseInt( params.get("InterfaceType") ) );
        businessPkgmsg.setRequestMsg(params.get("requestMsg"));
        businessPkgmsg.setReturnMsg(params.get("returnMsg"));
        businessPkgmsg.setUnnotifyMsg( params.get("unnotifyMsg"));
        businessPkgmsg.setStatus( PkgMsgStatus.正在处理中.getStatus() );
        return businessPkgmsg;
    }*/

    /*public static SignatureBusinessPkgmsg getSignatureBusinessPkgmsg(Map<String, String> params) {
        SignatureBusinessPkgmsg businessPkgmsg = new SignatureBusinessPkgmsg();
        businessPkgmsg.setUserId( Long.parseLong( params.get("userId") ) );
        businessPkgmsg.setTradeNo(params.get("tradeNo"));
        businessPkgmsg.setPassCode(params.get("passCode"));
        businessPkgmsg.setMerchantNo(params.get("merchantNo"));

        businessPkgmsg.setInterfaceType( Integer.parseInt( params.get("InterfaceType") ) );
        businessPkgmsg.setRequestMsg(params.get("requestMsg"));
        businessPkgmsg.setReturnMsg(params.get("returnMsg"));
        businessPkgmsg.setUnnotifyMsg( params.get("unnotifyMsg"));
        businessPkgmsg.setStatus( PkgMsgStatus.正在处理中.getStatus() );
        return businessPkgmsg;
    }*/

    /*public static SignaturePlatformPkgMsg getSignaturePlatformPkgMsg(Map<String, String> params) {
        SignaturePlatformPkgMsg businessPkgmsg = new SignaturePlatformPkgMsg();
        if (params.containsKey("userId") && StringUtils.isNotBlank(params.get("userId"))){
            businessPkgmsg.setUserId( Long.parseLong( params.get("userId") ) );
        }
        businessPkgmsg.setTradeNo(params.get("tradeNo"));
        businessPkgmsg.setPassCode(params.get("passCode"));
        businessPkgmsg.setMerchantNo(params.get("merchantNo"));

        if (params.containsKey("InterfaceType") && StringUtils.isNotBlank("InterfaceType")){
            businessPkgmsg.setInterfaceType( Integer.parseInt( params.get("InterfaceType") ) );
        }

        businessPkgmsg.setRequestMsg(params.get("requestMsg"));
        businessPkgmsg.setReturnMsg(params.get("returnMsg"));
        businessPkgmsg.setUnnotifyMsg( params.get("unnotifyMsg"));
        businessPkgmsg.setStatus( PkgMsgStatus.正在处理中.getStatus() );
        return businessPkgmsg;
    }*/



    /**
     * 封装合同上传报文
     * @param contractNo
     * @param contractTitle
     * @param file
     * @param platTradeNo
     * @return
     */
    /*public static Map<String,String> getUploadContractMapByParms(String contractNo,String contractTitle,String file,String platTradeNo) {
        Map<String, String > queryMap = new HashMap<String, String >();
        queryMap.put("contractNo", contractNo );
        queryMap.put("contractTitle", contractTitle );
        queryMap.put("file",file);
        queryMap.put("platTradeNo",platTradeNo);
        return queryMap;
    }*/


    /**
     * 封装合同签章报文
     * @param contractNo
     * @return
     */
    /*public static Map<String,String> getContractSignatureMapByParms(String contractNo,Map<String, String> params ) {
        Map<String, String > queryMap = new HashMap<String, String >();
        queryMap.put("batch_id",params.get("batchId") );
        queryMap.put("client_type",params.get("clientType") );
        queryMap.put("customer_id",params.get("customerId") );
        queryMap.put("client_role",params.get("clientRole") );
        queryMap.put("contract_id",contractNo );
        queryMap.put("contract_title",params.get("contractTitle") );
        queryMap.put("sign_keyword",params.get("signKeyword") );
        queryMap.put("notify_url",params.get("notifyUrl") );
        return queryMap;
    }*/

}
